<?php

namespace app\common\model;

use think\Model;

class Users extends Model
{
    protected $name = 'users';
    protected $type = [
        // 设置create_time为时间戳类型（整型）
        'reg_time' => 'timestamp:Y-m-d H:i:s',
    ];
    
    //修改器
    protected function setpwdAttr($value)
    {
        return md5($value);
    }
    
    
    public function getStatusTextAttr($value, $data)
    {
        $status = [-1 => '删除', 0 => '禁用', 1 => '正常', 2 => '待审核'];
        return $status[$data['status']];
    }
    
    public function getReg_timeAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
    
    
}